{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import scipy.stats\n",
    "import seaborn\n",
    "import ergo"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Testing the internal method used to build a CDF from a bag of samples:\n",
    "\n",
    "Generate some samples, and convert to Foretold CDF:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ForetoldCdf(xs=[32.96928993558896, 36.938179897263346, 40.907069858937724, 44.87595982061211, 48.844849782286495, 52.81373974396088, 56.78262970563526, 60.751519667309644, 64.72040962898403, 68.68929959065841], ys=[0.0, 0.002, 0.034500000000000065, 0.16050000000000006, 0.4175000000000001, 0.7265000000000001, 0.9165000000000004, 0.9830000000000004, 0.9965000000000004, 1.0])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "loc = 50\n",
    "scale = 5\n",
    "samples = np.random.normal(loc, scale, size=2000)\n",
    "cdf = ergo.foretold.ForetoldCdf.from_samples(samples, length=10)\n",
    "cdf"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Compare the CDF derived from samples with the true CDF:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3deXhU5d3G8e9vJgsBEiAk7DsEEBAVIov7AgouUKsoiFat1drWam1fbV3aWtq6ti61btS6V9C6UgtSFMUNhCCIshoWIYgkGPYssz3vHzPUFFkCTH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ONE3O94mekFqiF6g+rUEyLWsxj+SEd0v9ll95nLO3eic6+Cc60L0T7yZzrnxeDxee8l1kdfjZWZNzCx7133gtFiGmhc+9+L1tcdcu8Yr5hzq//X1FbDOzHrFVp0KLMHj8dpbLq/Hq4ZxfLO7BepqvJxzCX0D+gMLgEVE/zF+E1vfDZgLFBP9MyYzQXLNBD6NrXsWaOrh2J0EvJ4I47WPXJ6OV2xcPondFgM3x9a3JHr0wefAm0BuguR6JjZei4iWQlsP/v2OBIpiGV4FWng9XvvIlQjj1QT4GmhWY12djJc++i8ikiQSfpeLiIjUjgpdRCRJqNBFRJKECl1EJEmo0EVEkoQKXUQkSajQRUSSxP8D/5X6OufKnZoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "xs = np.linspace(loc - scale * 4, loc + scale * 4, 100)\n",
    "ys = scipy.stats.norm.cdf(xs, loc=loc, scale=scale)\n",
    "seaborn.lineplot(xs, ys);\n",
    "seaborn.lineplot(cdf.xs, cdf.ys);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Testing submission:\n",
    "\n",
    "Submit samples as a prediction (measurement) of a [question](https://www.foretold.io/c/f45577e4-f1b0-4bba-8cf6-63944e63d70c/m/cf86da3f-c257-4787-b526-3ef3cb670cb4) outcome (measureable):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "token = \"YOUR-TOKEN\"\n",
    "foretold = ergo.Foretold(token)\n",
    "question = foretold.get_question(\"cf86da3f-c257-4787-b526-3ef3cb670cb4\")\n",
    "response = question.submit_from_samples(samples, length=20)\n",
    "response"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
